package com.atguigu.entity;

import com.atguigu.group.AddGroup;
import com.atguigu.group.UpdateGroup;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import java.util.List;

@Data
public class Admin extends BaseEntity {
	private static final long serialVersionUID = 1L;

	@NotBlank(groups = AddGroup.class)
	@Size(groups = UpdateGroup.class,max = 12, min = 4,message = "用户名的长度不对")
	//用户名
	private String username;
	@NotBlank(groups ={ AddGroup.class,UpdateGroup.class},message = "密码不能为空")
	@Size(max = 12, min = 6,groups = { AddGroup.class,UpdateGroup.class},message = "密码长度不对")
	//密码
	private String password;
	@NotBlank(groups = AddGroup.class,message = "姓名不能为空")
	//姓名   
	private String name;
	@Pattern(regexp = "^1[3456789]\\d{9}$",groups ={ AddGroup.class,UpdateGroup.class},message = "电话号码不符合要求")
	//手机   
	private String phone;
	//头像地址
	private String headUrl;
	//描述   
	private String description;

	private List<Role> roleList;
}

